﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Vds2465Telegrams
{
    [TestClass]
    public class ReportType_Device_Test
    {
        [TestMethod]
        [Owner("Frank Eppink")]
        public void Test01_Equals()
        {
            ReportType_Device reportTypeDevice = new ReportType_Device(false, eReportSubType_Device.SystemDisruption);

            {
                // completely different type - NOT equal
                object dummyObject = new object();
                Assert.IsFalse(reportTypeDevice.Equals(dummyObject));
            }

            {
                // same type - same property values
                ReportType_Device reportTypeDevice2compare = new ReportType_Device(reportTypeDevice.OnOffFlag, reportTypeDevice.ReportSubType);
                Assert.IsTrue(reportTypeDevice.Equals(reportTypeDevice2compare));
            }

            {
                // same type - different OnOffFlag
                ReportType_Device reportTypeDevice2compare = new ReportType_Device(!reportTypeDevice.OnOffFlag, reportTypeDevice.ReportSubType);
                Assert.IsFalse(reportTypeDevice.Equals(reportTypeDevice2compare));
            }

            {
                // same type - different ReportSubType
                eReportSubType_Device reportSubTypeDevice = eReportSubType_Device.Reset;
                if (reportTypeDevice.ReportSubType == eReportSubType_Device.Reset)
                {
                    reportSubTypeDevice = eReportSubType_Device.Restart;
                }
                ReportType_Device reportTypeDevice2compare = new ReportType_Device(reportTypeDevice.OnOffFlag, reportSubTypeDevice);
                Assert.IsFalse(reportTypeDevice.Equals(reportTypeDevice2compare));
            }
        }

        [TestMethod]
        [Owner("Frank Eppink")]
        public void Test02_GetHashCode()
        {
            ReportType_Device reportTypeDevice = new ReportType_Device(false, eReportSubType_Device.DoorContact);
            int hashCode01 = reportTypeDevice.GetHashCode();
        }

        [TestMethod]
        [Owner("Frank Eppink")]
        public void Test03_ToString()
        {
            ReportType_Device reportTypeDevice = new ReportType_Device(true, eReportSubType_Device.SwitchOff);
            string stringResult = reportTypeDevice.ToString();
            Assert.IsNotNull(stringResult);
        }
    }
}
